﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>关闭页面弹出提示框</title>
</head>
<body onbeforeunload="return myFunction()">
    <p>关闭当前窗口，触发 onbeforeunload 事件。</p>
    <script>
        function myFunction() {
            return "我在这写点东西...";
        }
    </script>
</body>
</html>